.class public Lrexsee/core/browser/RexseeGarbageCollector;
.super Ljava/lang/Object;
.source "RexseeGarbageCollector.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field private static final INTERFACE_NAME:Ljava/lang/String; = "GarbageCollector"


# instance fields
.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mCollector:Ljava/lang/Runnable;

.field private final mContext:Landroid/content/Context;

.field private mCycle:I

.field private final mHandler:Landroid/os/Handler;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;)V
    .locals 1
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 43
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 28
    const/16 v0, 0x7d0

    iput v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCycle:I

    .line 29
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mHandler:Landroid/os/Handler;

    .line 30
    new-instance v0, Lrexsee/core/browser/RexseeGarbageCollector$1;

    invoke-direct {v0, p0}, Lrexsee/core/browser/RexseeGarbageCollector$1;-><init>(Lrexsee/core/browser/RexseeGarbageCollector;)V

    iput-object v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCollector:Ljava/lang/Runnable;

    .line 44
    iput-object p1, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mBrowser:Lrexsee/core/browser/Browser;

    .line 45
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mContext:Landroid/content/Context;

    .line 46
    return-void
.end method

.method static synthetic access$0(Lrexsee/core/browser/RexseeGarbageCollector;)I
    .locals 1

    .prologue
    .line 28
    iget v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCycle:I

    return v0
.end method

.method static synthetic access$1(Lrexsee/core/browser/RexseeGarbageCollector;)Landroid/os/Handler;
    .locals 1

    .prologue
    .line 29
    iget-object v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic access$2(Lrexsee/core/browser/RexseeGarbageCollector;)Ljava/lang/Runnable;
    .locals 1

    .prologue
    .line 30
    iget-object v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCollector:Ljava/lang/Runnable;

    return-object v0
.end method


# virtual methods
.method public freeMemory()V
    .locals 0

    .prologue
    .line 62
    invoke-static {}, Ljava/lang/System;->gc()V

    .line 63
    return-void
.end method

.method public getAutoCollectorCycle()I
    .locals 1

    .prologue
    .line 68
    iget v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCycle:I

    return v0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 18
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 14
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "GarbageCollector"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getMemoryInfo()Ljava/lang/String;
    .locals 6

    .prologue
    const-string v5, ","

    .line 50
    new-instance v0, Landroid/app/ActivityManager$MemoryInfo;

    invoke-direct {v0}, Landroid/app/ActivityManager$MemoryInfo;-><init>()V

    .line 51
    .local v0, "mi":Landroid/app/ActivityManager$MemoryInfo;
    iget-object v2, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mContext:Landroid/content/Context;

    const-string v3, "activity"

    invoke-virtual {v2, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p0

    .end local p0    # "this":Lrexsee/core/browser/RexseeGarbageCollector;
    check-cast p0, Landroid/app/ActivityManager;

    invoke-virtual {p0, v0}, Landroid/app/ActivityManager;->getMemoryInfo(Landroid/app/ActivityManager$MemoryInfo;)V

    .line 52
    const-string v1, "{"

    .line 53
    .local v1, "rtn":Ljava/lang/String;
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "\"available\":"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-wide v3, v0, Landroid/app/ActivityManager$MemoryInfo;->availMem:J

    invoke-virtual {v2, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, ","

    invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 54
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "\"threshold\":"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-wide v3, v0, Landroid/app/ActivityManager$MemoryInfo;->threshold:J

    invoke-virtual {v2, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, ","

    invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 55
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "\"lowMemory\":"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-boolean v3, v0, Landroid/app/ActivityManager$MemoryInfo;->lowMemory:Z

    invoke-static {v3}, Ljava/lang/String;->valueOf(Z)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 56
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "}"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 57
    return-object v1
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 22
    return-object p0
.end method

.method public setAutoCollectorCycle(I)V
    .locals 0
    .param p1, "milliseconds"    # I

    .prologue
    .line 65
    iput p1, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCycle:I

    .line 66
    return-void
.end method

.method public startAutoCollector()V
    .locals 1

    .prologue
    .line 71
    iget-object v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCollector:Ljava/lang/Runnable;

    invoke-interface {v0}, Ljava/lang/Runnable;->run()V

    .line 72
    return-void
.end method

.method public stopAutoCollector()V
    .locals 1

    .prologue
    .line 74
    const/4 v0, 0x0

    iput v0, p0, Lrexsee/core/browser/RexseeGarbageCollector;->mCycle:I

    .line 75
    return-void
.end method
